<?php
use yii\widgets\ActiveForm;
use kartik\file\FileInput;
use yii\helpers\Html;
use yii\bootstrap\Modal;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
use kartik\select2\Select2;
use yii\web\JsExpression;
?>
<style type="text/css">
	.data-form label{
		color: white;
	}

	.data-form h1,h2,h3{
		color: white;
	}
</style>
<?php $form = ActiveForm::begin([
	'options' => ['enctype'=>'multipart/form-data'],
	]); ?>
	<div class="row data-form" style="width: 80%; margin: 0px auto; padding-top: 20px; padding-bottom: 20px;background: gray;">
		<h3 style="text-align:center;"><?=$pageTitle?></h3>
		<hr/>
		<div class="col-lg-4">
		<div class="panel panel-default">
		<!-- Default panel contents -->
		<div class="panel-heading">产品列表</div>
		<div class="panel-body">
		<p><i>本项目推广的产品</i></p>
		</div>
		  
		<?=$form->field($product, 'goods')->widget(Select2::classname(), [

			'initValueText' => $goodsElder,

		    'options' => [
		    	'placeholder' => '#搜索产品#',
		    	'multiple' => true,
		    	'id' => 'goods',
		    	],
		    'pluginOptions' => [
		        'allowClear' => false,
		        'minimumInputLength' => 1,
		        'language' => [
	                'errorLoading' => new JsExpression("function () { return 'Waiting...'; }"),
	            ],

	            'ajax' => [
	                'url' => Url::toRoute(['goods/search']),
	                'dataType' => 'json',
	                'data' => new JsExpression('function(params) { return {q:params.term}; }'),
	                'quietMillis' => 10000,
	            ],

	            'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
	            'templateResult' => new JsExpression('function(res) { return res.text; }'),
	            'templateSelection' => new JsExpression('function (res) { return res.text; }'),
		    ],
		])->label(false);?>

		
		</div>
		</div>

		<div class="col-lg-4">
		<div class="panel panel-default">
		<!-- Default panel contents -->
		<div class="panel-heading">文章列表</div>
		<div class="panel-body">
		<p><i>本项目推广的文章</i></p>
		</div>
		  
		<?=$form->field($product, 'article')->widget(Select2::classname(), [

			'initValueText' => $articleElder,

		    'options' => [
		    	'placeholder' => '#搜索文章#',
		    	'multiple' => true,
		    	'id' => 'article',
		    	],
		    'pluginOptions' => [
		        'allowClear' => false,
		        'minimumInputLength' => 1,
		        'language' => [
	                'errorLoading' => new JsExpression("function () { return 'Waiting...'; }"),
	            ],

	            'ajax' => [
	                'url' => Url::toRoute(['article/search']),
	                'dataType' => 'json',
	                'data' => new JsExpression('function(params) { return {q:params.term}; }'),
	                'quietMillis' => 10000,
	            ],

	            'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
	            'templateResult' => new JsExpression('function(res) { return res.text; }'),
	            'templateSelection' => new JsExpression('function (res) { return res.text; }'),
		    ],
		])->label(false);?>

		
		</div>
		</div>

		<div class="col-lg-4">
		<div class="panel panel-default">
		<!-- Default panel contents -->
		<div class="panel-heading">人物列表</div>
		<div class="panel-body">
		<p><i>本项目推广的人物</i></p>
		</div>
		  
		<?=$form->field($product, 'human')->widget(Select2::classname(), [

			'initValueText' => $humanElder,

		    'options' => [
		    	'placeholder' => '#搜索人物#',
		    	'multiple' => true,
		    	'id' => 'human',
		    	],
		    'pluginOptions' => [
		        'allowClear' => false,
		        'minimumInputLength' => 1,
		        'language' => [
	                'errorLoading' => new JsExpression("function () { return 'Waiting...'; }"),
	            ],

	            'ajax' => [
	                'url' => Url::toRoute(['human/search']),
	                'dataType' => 'json',
	                'data' => new JsExpression('function(params) { return {q:params.term}; }'),
	                'quietMillis' => 10000,
	            ],

	            'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
	            'templateResult' => new JsExpression('function(res) { return res.text; }'),
	            'templateSelection' => new JsExpression('function (res) { return res.text; }'),
		    ],
		])->label(false);?>

		
		</div>
		</div>
		<div class="col-lg-12">
			<?=Html::Button('添加', ['class'=>'btn btn-success btn-block','name' =>'submit-button'])?>
		</div>
	</div>
<?php ActiveForm::end(); ?>
